In this dashboard, we summarize the information from the data provided by Ohio Department of Health.
In this data set, there are 8 variables.
Today: ‘April 02, 2020’
The latest onset date is April 01, 2020.
Here is the distribution of confirmed cases by the Age Range.
In progress!
---
title: "Ohio COVID-19"
author: "Ying-Ju Tessa Chen"
output:
flexdashboard::flex_dashboard:
theme: journal
orientation: columns
social: ["facebook", "twitter", "linkedin"]
source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard) ## you need this package to create dashboard
```
Basic Information
=======================================================================
Column {data-width=500}
---
### Introduction
In this dashboard, we summarize the information from the data provided by Ohio Department of Health.
In this data set, there are 8 variables.
- County: 88 counties
- Sex: Female, Male, Unknown
- Age Range: 0-19, 20-29, 30-39, 40-49, 50-59, 60-69, 70-79, 80+, Unknown
- Onset Data
- Date of Death
- Case Count
- Death Count
- Hospitalized Count
### Data Preparation
1. Load the necessary packages
2. Read the data set from
3. Replace the space in each column name by an underscore
4. Remove the last row in the data table that shows the total count
```{r}
# load necessary packages
library(data.table)
library(ggplot2)
library(plotly)
library(plyr)
```
```{r}
df <- fread("https://coronavirus.ohio.gov/static/COVIDSummaryData.csv")
colnames(df) <- c("County", "Sex", "Age_Range", "Onset_Date",
"Date_Of_Death", "Case_Count",
"Death_Count", "Hospitalized_Count")
# remove the last row that shows the total count and make sure the type of each variable is correct
df <- as.data.frame(df[1:(nrow(df)-1),])
df[,1:3] <- lapply(df[,1:3], factor)
df[,4:5] <- lapply(df[,4:5], function(x) as.Date(x, "%m/%d/%Y"))
df[,6:8] <- lapply(df[,6:8], as.numeric)
```
Column {data-width=500}
---
```{r}
all_dates <- names(table(df$Onset_Date))
previous_date <- as.Date(all_dates[(length(all_dates)-1)], "%Y-%m-%d")
latest_date <- sort(df$Onset_Date, decreasing = TRUE)[1]
latest_date_index <- which(df$Onset_Date==latest_date)
increase_case <- sum(df$Case_Count)-sum(df$Case_Count[-latest_date_index])
increase_Hospitalization <- sum(df$Hospitalized_Count)-sum(df$Hospitalized_Count[-latest_date_index])
increase_death <- sum(df$Death_Count)-sum(df$Death_Count[-latest_date_index])
```
### Summary Statistics
**Today: '`r format(Sys.Date(), "%B %d, %Y")`'**
**The latest onset date is `r format(latest_date, "%B %d, %Y")`.**
- Total Number of **Confirmed Cases**: `r sum(df$Case_Count)`
- Total Number of **Hospitalizations**: `r sum(df$Hospitalized_Count)`
- Total Number of **Deaths**: `r sum(df$Death_Count)`
### Distribution of Confirmed Cases by the Age Range
Here is the distribution of confirmed cases by the Age Range.
```{r}
# remove the cases for which the age range is "Unknown"
if (length(which(df$Age_Range=="Unknown"))==0){
df1 <- df
}else{
df1 <- df[-which(df$Age_Range=="Unknown"),]
}
df1$Age_Range <- factor(df1$Age_Range)
# find counts and relative counts (%) in each age range
Age_Dist <- table(df1$Age_Range, df1$Case_Count)
n <- sum(apply(Age_Dist, 1, function(x) sum(x*as.numeric(colnames(Age_Dist)))))
Age_Percent <- round(apply(Age_Dist, 1, function(x) sum(x*as.numeric(colnames(Age_Dist))))/n*100,2)
# obtatin the bar chart for the distribution of Ohio's confirmed cases by the Age Range
df_age <- data.frame(Age_Range=levels(df1$Age_Range), Percent_Cases=Age_Percent, text1=paste0(Age_Percent, "%"))
p_age <- plot_ly(df_age, x=~Age_Range, y=~Percent_Cases, type="bar",
text = df_age$text1, textposition = 'auto')%>% config(displayModeBar = F)
p_age <- p_age %>% layout(title="Ages of Ohio's Confirmed Cases", xaxis=list(title="Age Range"), yaxis=list(title="Percent of Cases"))
p_age
```
Advance Information
=======================================================================
In progress!